#!/usr/bin/env python
# encoding: utf-8
'''
@author: zhaowenpeng
@contact: winston@peipeiyun.com
@software: garner
@file: modify_tables.py
@time: 2020/12/28 上午11:36
@desc:
'''
import click
from core.migrations import MigrationModel,database,info,migrator
from playhouse.migrate import migrate
from models.config import Config

class ConfigMigration(MigrationModel):
    _model = Config

@click.command()
def migrate_tables():
    '''数据库变更'''
    config = ConfigMigration()

    with database.transaction():
        config.auto_migrate()
        database.commit()
    print("Success Migration")